import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:vischat/generated/icons/app_icons.dart';

class DefaultLoading extends StatelessWidget {
  const DefaultLoading({super.key});

  @override
  Widget build(BuildContext context) {
    return Center(child: CircularProgressIndicator());
  }
}

class DefaultEmpty extends StatelessWidget {
  const DefaultEmpty({super.key});

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          Icon(AppIcons.no_data, size: 72.r, color: Colors.grey[400]),
          SizedBox(height: 16.h),
          Text(
            'viewState.noData'.tr,
            style: TextStyle(color: Colors.grey, fontSize: 28.sp),
          ),
        ],
      ),
    );
  }
}

class DefaultError extends StatelessWidget {
  final String error;
  final VoidCallback retry;
  const DefaultError({super.key, required this.error, required this.retry});

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          Icon(Icons.error_outline, size: 64.r, color: Colors.red),
          SizedBox(height: 16.sp),
          Text(error, style: TextStyle(color: Colors.red)),
          SizedBox(height: 16.h),
          ElevatedButton(onPressed: retry, child: Text('viewState.retry'.tr)),
        ],
      ),
    );
  }
}

class DefaultNoMore extends StatelessWidget {
  final String? text;
  const DefaultNoMore({super.key, this.text});

  @override
  Widget build(BuildContext context) {
    return Container();
    //return Text(text??'viewState.noMore'.tr);
  }
}

class DefaultLoadMore extends StatelessWidget {
  final String? text;
  const DefaultLoadMore({super.key, this.text});

  @override
  Widget build(BuildContext context) {
    return Text(text ?? 'viewState.loadMore'.tr);
  }
}
